<?php

/*
 * To change this template, choose Tools | Templates
* and open the template in the editor.
*/
require 'connection.php';

try{
	$con = connect();

	$notificationId = $_POST['notificationId'];
	$name = $_POST['name'];
	$place = $_POST['place'];
	$date = $_POST['date'];
	$hour = $_POST['hour'];
	$urlImage = $_POST['urlImage'];

	$sql = "UPDATE notificacion SET nombre = '".$name."' , lugar = '".$place."' , fecha = '".$date."' , hora = '".$hour."'";

	if($urlImage != ""){
		$sql = $sql." , imagen = 'http://alquimiabtl.com/secured/aplicaciones/notificaciones/uploads/" . $urlImage."'";
	}

	$sql = $sql." WHERE idnotificacion = ".$notificationId;

	if($con->query($sql)){
		echo 'successful';
	}else{
		echo 'error actualizando la notificacion';
	}
	mysqli_close($con);
}catch (Exception $e){
	echo $e->getMessage();
}


?>
